<?php
//
namespace app\home\controller;

use app\common\model\ShopGoodsBrandModel;
use think\Request;

class BrandController extends BaseController
{

    private $brandModel;

    public function __construct(Request $request)
    {
        parent::__construct($request);
        $this->brandModel = new ShopGoodsBrandModel();
    }

    /**
     * 品牌首页
     * @return mixed
     */
    public function index(){
        $itemList = $this->brandModel->where('status',1)->select();
        $this->assign('itemList',$itemList);
        return $this->fetch();
    }

    /*
     * 品牌内容页
     */
    public function item()
    {
        $brandId=$this->request->param('brand_id/d');
        $info=$this->brandModel->where('brand_id',$brandId)->find();
        $info=format_brand_content($info);
        $this->assign('info',$info);
        $itemList=goods_page_list(0,10,['brand_id'=>$brandId]);
        if($this->request->isAjax()){
            return $itemList;
        }
        $this->assign('itemList',$itemList);
        return $this->fetch();
    }

}
